home *** CD-ROM | disk | FTP | other *** search
- Path: news.rwth-aachen.de!news
- From: Sebastian Brandt <csb>
- Newsgroups: comp.lang.c++
- Subject: Re: HELP!!! - loop control problems
- Date: 22 Jan 1996 12:47:49 GMT
- Organization: RWTH -Aachen / Rechnerbetrieb Informatik
- Message-ID: <4e011l$a7f@news.rwth-aachen.de>
- References: <4ds174$6t0@bolivia.it.earthlink.net> <3101abf0.164809733@news.primenet.com>
- NNTP-Posting-Host: marlowe.informatik.rwth-aachen.de
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.12 (X11; I; SunOS 5.4 sun4m)
- X-URL: news:3101abf0.164809733@news.primenet.com
-
- > trying: const long SCREEN_SIZE = (long) 320 * 200;
- The idea proposed won't work on normal 16-bit-compilers, because the conversion
- to "long" still takes place after calculating the result of 64000, i.e. -1535
- (or something like it).
- To solve the problem, both values have to be converted before you multiply:
-
- either
- const long SCREEN_SIZE = ((long) 320) * ((long)200);
-
- or - as both values are constant expressions -
- const long SCREEN_SIZE = 300L * 200L;
-
- I agree, is's just waful 16-bit code, you should see my Win3.1-progs using long
- bitshifts.
-
-